package cn.fighter3.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author: 三分恶
 * @Date: 2021/5/30
 * @Description: Nacos配置项获取
 **/

@RefreshScope
@RestController
@RequestMapping("/shop-user")
@Api(value = "配置信息接口", tags = "配置信息接口")
public class NacosConfigController {
    @Value("${project.name:}")
    private String projectName;

    @Value("${project.author:}")
    private String projectAuthor;

    @GetMapping("/config")
    @ApiOperation(value = "获取Nacos配置项")
    public Map<String, Object> getConfig() {
        Map<String, Object> configMap = new HashMap();
        configMap.put("projectName", projectName);
        configMap.put("projectAuthor", projectAuthor);
        return configMap;
    }

}
